package com.dbms;

import java.util.ArrayList;
import java.util.List;
/**
 * 
 * @author yunxiangfu@163.com
 *
 */
public class DatabaseParameterList {

	private List<DatabaseParameter> list;
	public DatabaseParameterList(){
		list = new ArrayList<DatabaseParameter>();
	}
	public void add(String key,Object value){
		list.add(new DatabaseParameter(key,value,SQLTool.getObjectType(value)));
	}
	public void add(String key,Object value,int sqlType){
		list.add(new DatabaseParameter(key,value,sqlType));
	}
	public void add(String key,Object value,boolean action){
		list.add(new DatabaseParameter(key,value,0,action));
	}

	public DatabaseParameter get(String key){
		for(DatabaseParameter parameter:list){
			if(key.equalsIgnoreCase(parameter.getKey()))
				return parameter;
		}
		return null;
	}
	public DatabaseParameter get(int index){
		return list.get(index);
	}
	public List<DatabaseParameter> getList(){
		return list;
	}
	public int size(){
		return list.size();
	}
}
